package com.pda.xinma.ui.machinecall;

import android.widget.TextView;

import com.pda.xinma.R;
import com.pda.xinma.bean.DeliveryInfoBean;
import com.pda.xinma.bean.LatheOrderBean;
import com.pda.xinma.contract.MachineCallStaticsContract;
import com.pda.xinma.presenter.MachineCallStaticsPresenter;
import com.wangshen.base.ui.mvp.base.ui.BaseMvpFragment;

import butterknife.BindView;

public class MachineCallStaticsFragment extends BaseMvpFragment<MachineCallStaticsPresenter> implements MachineCallStaticsContract.View {
    LatheOrderBean orderBean;
    @BindView(R.id.tv_container)
    TextView tvContainer;
    @BindView(R.id.tv_center)
    TextView tvCenter;
    @BindView(R.id.tv_machine)
    TextView tvMachine;
    @BindView(R.id.tv_processName)
    TextView tvProcessName;
    @BindView(R.id.tv_articleId)
    TextView tvArticleId;
    @BindView(R.id.tv_model)
    TextView tvModel;
    @BindView(R.id.tv_grade)
    TextView tvGrade;
    @BindView(R.id.tv_planNum)
    TextView tvPlanNum;
    @BindView(R.id.tv_alreadyOutNum)
    TextView tvAlreadyOutNum;

    public MachineCallStaticsFragment(LatheOrderBean orderBean) {
        this.orderBean = orderBean;
    }

    public MachineCallStaticsFragment() {
    }

    @Override
    public MachineCallStaticsPresenter getPresenter() {
        return new MachineCallStaticsPresenter();
    }

    @Override
    public int getViewId() {
        return R.layout.fragment_machine_call_statics;
    }

    @Override
    public void initView() {
        tvCenter.setText(orderBean.getCenterName());
        tvMachine.setText(orderBean.getLatheName());
        tvContainer.setText(orderBean.getProOrderNo());
        presenter.getDeliveryInfoByFlowId(orderBean.getFlowId());
    }

    @Override
    public void initLinsenterner() {

    }

    @Override
    public void getData() {

    }

    @Override
    public void setData(DeliveryInfoBean data) {
        if (data != null){
            tvAlreadyOutNum.setText(data.getAlreadyOutNum());
            tvGrade.setText(data.getGrade());
            tvProcessName.setText(data.getProcessName());
            tvArticleId.setText(data.getArticleId());
            tvModel.setText(data.getModel());
            tvPlanNum.setText(data.getPlanNum());
        }
    }
}
